#![no_std]
#![no_main]

extern crate panic_halt;
extern crate stm32f1xx_hal as hal;


use cortex_m::asm;
use cortex_m_rt::entry;

use hal::prelude::*;
use hal::stm32;


fn delay() {
    for _ in 0..10000 {
        asm::nop()
    }
}

#[entry]
fn main() -> ! {
  
    let dp = stm32::Peripherals::take().unwrap();
    let mut gpioc = dp.GPIOC.split();

    // LED 对应的 PC13 引脚
    let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);

    loop {

        // 点亮 LED
        led.set_high();
        delay();
        // 关闭 LED
        led.set_low();
        delay();
    }
}
